<%@page import="qldc.pm.tienan.model.TEMP_DoiTuongTienAn"%>
<%@page import="qldc.pm.tienan.service.TEMP_DoiTuongTienAnLocalServiceUtil"%>
<%@page import="qldc.pm.qtht.dmdc.service.QuanHuyenLocalServiceUtil"%>
<%@page import="qldc.pm.qtht.dmdc.model.QuanHuyen"%>
<%@page import="qldc.pm.tienan.constants.ThaoTacUndoRedoEnum"%>
<%@page import="qldc.pm.tienan.service.TEMP_PhieuThongTinVeNguoiCoTienAnLocalServiceUtil"%>
<%@page import="qldc.pm.tienan.model.TEMP_PhieuThongTinVeNguoiCoTienAn"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="qldc.pm.tienan.service.TEMP_TienAnLocalServiceUtil"%>
<%@page import="qldc.pm.tienan.model.TEMP_TienAn"%>
<%@page import="qldc.pm.tienan.service.PhieuThongTinVeNguoiCoTienAnLocalServiceUtil"%>
<%@page import="qldc.pm.tienan.model.PhieuThongTinVeNguoiCoTienAn"%>
<%@page import="qldc.pm.tienan.service.DoiTuongTienAnDTOLocalServiceUtil"%>
<%@page import="qldc.pm.tienan.service.TienAnLocalServiceUtil"%>
<%@page import="qldc.pm.tienan.model.TienAn"%>
<%@page import="com.liferay.portal.kernel.util.Constants"%>
<%@page import="qldc.pm.qtht.dmdc.enumclass.EnumGioiTinh"%>
<%@page import="com.liferay.portal.kernel.util.StringPool"%>
<%@page import="qldc.pm.qtht.dmdc.service.TinhLocalServiceUtil"%>
<%@page import="qldc.pm.qtht.dmdc.model.Tinh"%>
<%@page import="java.util.List"%>
<%@page import="qldc.pm.qtht.dmdc.service.TonGiaoLocalServiceUtil"%>
<%@page import="qldc.pm.qtht.dmdc.model.TonGiao"%>
<%@page import="qldc.pm.qtht.dmdc.service.DanTocLocalServiceUtil"%>
<%@page import="qldc.pm.qtht.dmdc.model.DanToc"%>
<%@page import="qldc.pm.qtht.dmdc.utils.DiaChiUtils"%>
<%@page import="com.liferay.portal.kernel.util.Validator"%>
<%@page import="qldc.pm.csdl.cd90.service.CongDanDTOLocalServiceUtil"%>
<%@page import="qldc.pm.csdl.cd90.model.dto.CongDanDTO"%>

<%@include file="../../init.jsp"%>

<%
String redirect = ParamUtil.getString(request, "redirect");

String pathThemeImages = themeDisplay.getPathThemeImages();

String soDinhDanhCaNhan = ParamUtil.getString(request, "soDinhDanhCaNhan");

long doiTuongTienAnId = ParamUtil.getLong(request, "doiTuongTienAnId");

String cmd = ParamUtil.getString(request, Constants.CMD);

long tienAnId = ParamUtil.getLong(request, "tienAnId");

String thaoTac = ParamUtil.getString(request, "thaoTac");

String undoRedo = ParamUtil.getString(request, "undoRedo");

if (Validator.isNotNull(thaoTac)) {
	if (thaoTac.equals(Constants.DELETE)) {
		cmd = Constants.ADD;
	} else {
		cmd = Constants.EDIT;
	}
}

String hoVaTen = "";
String gioiTinhKey = "";
String soCMND = "";
String soSoHoKhau = "";
String ngaySinh = "";
String danToc = "";
String tonGiao = "";
String quocTich = "";
String hoTenCha = "";
String hoVaTenMe = "";
String toaAnXuPhat = "";
String diaChiToaAnXuPhat = "";
String ngayToaAn = "";
String toiDanh = "";
String ngayPhamToi = "";
String banAnSo = "";
String maSoHoSoTienAnTuToaAn = "";
String chuThichCuaPhieuThongTin = "";
String hoVaTenKhac = "";
String soHoChieu = "";
String noiSinh = "";
String ngayCap = "";
String hoTenVoHoacChong = "";
String hinhPhatChinh = "";
String hinhPhatBoSung = "";
String nghiaVuDanSu = "";
String chuThich = "";
String nguoiTrichLuc = "";
String thamPhan = "";
String anPhi = "";
String moTaTienAn = "";
long noiThuongTruTinhId = 0;
long noiThuongTruQuanHuyenId = 0;
long noiThuongTruPhuongXaId = 0;
String noiThuongTruDiaChi = "";
long noiTamTruTinhId = 0;
long noiTamTruQuanHuyenId = 0;
long noiTamTruPhuongXaId = 0;
String noiTamTruDiaChi = "";

CongDanDTO congDanDTO = CongDanDTOLocalServiceUtil.findBySoDinhDanhCaNhan(soDinhDanhCaNhan);

if(Validator.isNotNull(congDanDTO)) {
	hoVaTen = congDanDTO.getHoVaTen();
	
	gioiTinhKey = EnumGioiTinh.getKey(congDanDTO.getGioiTinh());
	
	soCMND = congDanDTO.getSoCMND();
	soSoHoKhau = congDanDTO.getSoSoHoKhau();
	
	noiThuongTruQuanHuyenId = congDanDTO.getNoiThuongTruQuanHuyenId();
	noiThuongTruPhuongXaId = congDanDTO.getNoiThuongTruPhuongXaId();
	noiThuongTruDiaChi = congDanDTO.getNoiThuongTruDiaChi();
	
	ngaySinh = congDanDTO.getNgaySinh();
	
	long danTocId = congDanDTO.getDanTocId();
	if(danTocId > 0) {
		DanToc dmdcDanToc = DanTocLocalServiceUtil.findById(danTocId);
		
		if(Validator.isNotNull(dmdcDanToc)) {
			danToc = dmdcDanToc.getTenDanToc();
		}
	}
	
	long tonGiaoId = congDanDTO.getTonGiaoId();
	if(tonGiaoId > 0) {
		TonGiao dmdcTonGiao = TonGiaoLocalServiceUtil.findById(tonGiaoId);
		
		if(Validator.isNotNull(dmdcTonGiao)) {
			tonGiao = dmdcTonGiao.getTenTonGiao();
		}
	}
	
	quocTich = congDanDTO.getQuocTich();
	hoTenCha = congDanDTO.getHoVaTenCha();
	hoVaTenMe = congDanDTO.getHoVaTenMe();
}

if(tienAnId > 0) {
	if (Validator.isNull(thaoTac)) {
		TienAn tienAnToBeEdited = TienAnLocalServiceUtil.findByTienAnId(tienAnId);	
		if(Validator.isNotNull(tienAnToBeEdited)) {
			moTaTienAn = tienAnToBeEdited.getMoTaTienAn();
			toaAnXuPhat = tienAnToBeEdited.getToaAnXuPhat();
			ngayToaAn = DoiTuongTienAnDTOLocalServiceUtil.parseDateToString(tienAnToBeEdited.getNgayToaAn());
			toiDanh = tienAnToBeEdited.getToiDanh();
			ngayPhamToi = DoiTuongTienAnDTOLocalServiceUtil.parseDateToString(tienAnToBeEdited.getNgayPhamToi());
			hinhPhatChinh = tienAnToBeEdited.getHinhPhatChinh();
			banAnSo = tienAnToBeEdited.getBanAnSo();
			hoVaTenKhac = congDanDTO.getTenGoiKhac();
			hinhPhatBoSung = tienAnToBeEdited.getHinhPhatBoSung();
			nghiaVuDanSu = tienAnToBeEdited.getNghiaVuDanSu();
			chuThich = tienAnToBeEdited.getChuThich();
			soHoChieu = congDanDTO.getSoHoChieu();
			noiSinh = congDanDTO.getNoiSinhDiaChi();
			ngayCap = Validator.isNotNull(congDanDTO.getNgayCapCMND())?congDanDTO.getNgayCapCMND():"";
			anPhi  = String.valueOf(tienAnToBeEdited.getAnPhi());
			PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = PhieuThongTinVeNguoiCoTienAnLocalServiceUtil.findByTienAnId(tienAnId);
	
			if(Validator.isNotNull(phieuThongTinVeNguoiCoTienAn)) {
				maSoHoSoTienAnTuToaAn = phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn();
				noiTamTruDiaChi = phieuThongTinVeNguoiCoTienAn.getNoiTamTruDiaChi();
				chuThichCuaPhieuThongTin = phieuThongTinVeNguoiCoTienAn.getChuThich();
				nguoiTrichLuc = phieuThongTinVeNguoiCoTienAn.getNguoiTrichLuc();
				thamPhan = phieuThongTinVeNguoiCoTienAn.getThamPhan();
				hoTenVoHoacChong = phieuThongTinVeNguoiCoTienAn.getHoTenVoHoacChong();
				hoTenCha = phieuThongTinVeNguoiCoTienAn.getHoTenCha();
				hoVaTenMe = phieuThongTinVeNguoiCoTienAn.getHoTenMe();
				noiTamTruTinhId = phieuThongTinVeNguoiCoTienAn.getNoiTamTruTinhId();
				noiTamTruQuanHuyenId = phieuThongTinVeNguoiCoTienAn.getNoiTamTruQuanHuyenId();
				noiTamTruPhuongXaId = phieuThongTinVeNguoiCoTienAn.getNoiTamTruPhuongXaId();
				noiTamTruDiaChi = phieuThongTinVeNguoiCoTienAn.getNoiTamTruDiaChi();
			}
		}
	} else {
		SimpleDateFormat sdf = new SimpleDateFormat(TienAnConstants.DATE_PATTERN);
		TEMP_TienAn tienAnToBeEdited = TEMP_TienAnLocalServiceUtil.findByTEMPTienAnId(tienAnId);
		if(Validator.isNotNull(tienAnToBeEdited)) {
			moTaTienAn = tienAnToBeEdited.getMoTaTienAn();
			toaAnXuPhat = tienAnToBeEdited.getToaAnXuPhat();
			ngayToaAn = Validator.isNotNull(tienAnToBeEdited.getNgayToaAn())? sdf.format(tienAnToBeEdited.getNgayToaAn()):"";
			toiDanh = tienAnToBeEdited.getToiDanh();
			ngayPhamToi = Validator.isNotNull(tienAnToBeEdited.getNgayPhamToi())? sdf.format(tienAnToBeEdited.getNgayPhamToi()):"";
			hinhPhatChinh = tienAnToBeEdited.getHinhPhatChinh();
			banAnSo = tienAnToBeEdited.getBanAnSo();
			hoVaTenKhac = congDanDTO.getTenGoiKhac();
			hinhPhatBoSung = tienAnToBeEdited.getHinhPhatBoSung();
			nghiaVuDanSu = tienAnToBeEdited.getNghiaVuDanSu();
			chuThich = tienAnToBeEdited.getChuThich();
			soHoChieu = congDanDTO.getSoHoChieu();
			noiSinh = congDanDTO.getNoiSinhDiaChi();
			ngayCap = congDanDTO.getNgayCapCMND();
			anPhi  = String.valueOf(tienAnToBeEdited.getAnPhi());
			TEMP_PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = TEMP_PhieuThongTinVeNguoiCoTienAnLocalServiceUtil.findByTienAnId(tienAnToBeEdited.getTienAnId());
			tienAnId = tienAnToBeEdited.getMainTienAnId();
			TEMP_DoiTuongTienAn doiTuong = TEMP_DoiTuongTienAnLocalServiceUtil.fetchTEMP_DoiTuongTienAn(tienAnToBeEdited.getDoiTuongTienAnId());
			
			if (Validator.isNotNull(doiTuong)) {
				doiTuongTienAnId = doiTuong.getMainDoiTuongTienAnId();
			}
			
			if(Validator.isNotNull(phieuThongTinVeNguoiCoTienAn)) {
				maSoHoSoTienAnTuToaAn = phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn();
				noiTamTruDiaChi = phieuThongTinVeNguoiCoTienAn.getNoiTamTruDiaChi();
				chuThichCuaPhieuThongTin = phieuThongTinVeNguoiCoTienAn.getChuThich();
				nguoiTrichLuc = phieuThongTinVeNguoiCoTienAn.getNguoiTrichLuc();
				thamPhan = phieuThongTinVeNguoiCoTienAn.getThamPhan();
				hoTenVoHoacChong = phieuThongTinVeNguoiCoTienAn.getHoTenVoHoacChong();
				hoTenCha = phieuThongTinVeNguoiCoTienAn.getHoTenCha();
				hoVaTenMe = phieuThongTinVeNguoiCoTienAn.getHoTenMe();
			} 
		}
	}
}
	
boolean isDisplay = cmd.equals(Constants.VIEW);

PortletURL inReportURL = renderResponse.createActionURL();
inReportURL.setParameter(TienAnConstants.ACTION_HANDLER_PARAM, TienAnConstants.REPORT_ACTION);
inReportURL.setParameter(Constants.ACTION, "inReportChiTietTienAn");
inReportURL.setParameter("redirect", redirect.toString());
inReportURL.setParameter("soDinhDanhCaNhan", soDinhDanhCaNhan);
inReportURL.setParameter("doiTuongTienAnId", String.valueOf(doiTuongTienAnId));
inReportURL.setParameter("tienAnId", String.valueOf(tienAnId));
%>

<portlet:resourceURL var="loadQuanHuyen" id="loadQuanHuyen">
	<portlet:param name="tinhIdSelected" value="{0}" />
</portlet:resourceURL>

<portlet:resourceURL var="loadPhuongXa" id="loadPhuongXa">
	<portlet:param name="quanHuyenIdSelected" value="{0}" />
</portlet:resourceURL>

<portlet:renderURL var="chiTietTienAnUrl">
	<portlet:param name="mvcPath" value="/html/view.jsp" />
	<portlet:param name="chonChucNangItem" value="<%=TienAnConstants.QUAN_LY_NGUOI_CO_TIEN_AN%>" />
	<portlet:param name="tabs1" value="chi_tiet_tien_an" />
	<portlet:param name="doiTuongTienAnId" value="<%=String.valueOf(doiTuongTienAnId)%>" />
	<portlet:param name="soDinhDanhCaNhan" value="<%=soDinhDanhCaNhan%>" />
	<portlet:param name="redirect" value="<%=redirect.toString()%>" />
</portlet:renderURL>

<portlet:actionURL var="capNhatTienAnActionURL">
	<portlet:param name="<%=TienAnConstants.ACTION_HANDLER_PARAM%>" value="<%=TienAnConstants.QUAN_LY_NGUOI_CO_TIEN_AN %>" />
	<portlet:param name="<%=Constants.ACTION%>" value="capNhatTienAn" />
	<portlet:param name="soDinhDanhCaNhan" value="<%=soDinhDanhCaNhan%>" />
	<portlet:param name="<%=Constants.CMD%>" value="<%=cmd%>" />
	<portlet:param name="thaoTac" value="<%=thaoTac%>" />
	<portlet:param name="undoRedo" value="<%=undoRedo%>" />
	<portlet:param name="tienAnId" value="<%=String.valueOf(tienAnId)%>" />
	<portlet:param name="redirect" value="<%=chiTietTienAnUrl.toString()%>" />
</portlet:actionURL>

<portlet:resourceURL var="layMaPhieuThongTinTienAn" id="layMaPhieuThongTinTienAn">
</portlet:resourceURL>

<script type="text/javascript">
$(function() {
	var themTienAn = new ThemTienAn();
	themTienAn.initComponents({
		ngayToaAn: "<portlet:namespace/>ngayToaAn"
		, calendarIcon : "<%=pathThemeImages%>/common/calendar.png"
	});
});

function inDuLieu(url) {
	var form = $("<form>").attr({action: url, method:"POST",target:"_blank"});				
	form.appendTo(document.body).submit();
}
	
function <portlet:namespace/>layMa() {
	jQuery.ajax({
		url : "<%=layMaPhieuThongTinTienAn.toString() %>",
		dataType : 'json',
		type : "POST",
		cache : false,
		timeout : 10000,
		async : false,
		success : function(data) {
			$("#<portlet:namespace/>maSoHoSoTienAnTuToaAn").val(data.maSoHoSoTienAnTuToaAn);			
		},
		error : function(xhr, textStatus, errorThrown) {
			alert(textStatus);
		}
	});
}
	
function <portlet:namespace/>validate() {
	var isOk = true;
	
	var maso = $('#<portlet:namespace/>maSoHoSoTienAnTuToaAn');
	if (maso.val() == '') {
		showPopupConfirm('<liferay-ui:message key="xin-vui-long-lay-ma-so-phieu-thong-tin-tien-an" />',['Ok'],function(index) {
			maso.focus();
		});
		
		isOk = false;
	} else {
		var inputList = $(".mandatory");
		if (inputList.length > 0) {
			for (var i = 0;i<inputList.length;i++) {
				var firstItem = inputList.eq(i);
				if (firstItem.val() == '') {
					var messageName = firstItem.attr('message').toString();
					showPopupConfirm('<liferay-ui:message key="xin-vui-long-nhap-thong-tin" />  : [' + messageName + ']',['Ok'],function(index) {
						$(firstItem).focus();
						isOk = false;
						return;
					});
					
					isOk = false;
					break;
				}
			}	
		}
	}
	
	var ngayToaAn = $("#<portlet:namespace/>ngayToaAn");
	
	if(isSelectedDateAfterToday(ngayToaAn.val())) {
		showPopupConfirm('<liferay-ui:message key="ngay-tien-an-khong-dung-vui-long-chon-ngay-truoc-ngay-hien-tai" />', ['Ok'], function(index) {
			ngayToaAn.focus();
		});
		
		isOk = false;
	}

	return isOk;
}

function <portlet:namespace/>confirmMsg() {
	var co = '<liferay-ui:message key="co" />';
 	var khong = '<liferay-ui:message key="khong" />';
 	
 	if(<portlet:namespace/>validate()) {
 		showPopupConfirm('<liferay-ui:message key="ban-co-muon-luu-thong-tin" />',[co, khong], function(index) {
 		    if (index == 0){
 		    	var frm = $("#<portlet:namespace/>fm");
 		    	frm.find('[disabled="disabled"]').find('[disabled="disabled"]').removeAttr('disabled');
 		    	$("#<portlet:namespace/>fm").submit();
 			} else {
				return;
 	 		}
 		});
	} 
 	
}

</script>

<liferay-ui:header title="thong-tin-nguoi-co-tien-an" showBackURL="<%=false %>"></liferay-ui:header>

<form action="<%=capNhatTienAnActionURL %>" id="<portlet:namespace/>fm" name="<portlet:namespace/>fm" method="post">
	<table class="gridnormal">
		<tr>
			<td class="aui-w20"><liferay-ui:message key="ho-va-ten" /></td>
			<td class="aui-w30 txt-Bold"><%=hoVaTen %></td>
			<td class="aui-w20"><liferay-ui:message key="gioi-tinh" /></td>
			<td class="aui-w30 txt-Bold"><liferay-ui:message key="<%=gioiTinhKey %>" /></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="ho-va-ten-khac" /></td>
			<td class="txt-Bold"><%=hoVaTenKhac %></td>
			<td><liferay-ui:message key="so-so-ho-khau" /></td>
			<td class="txt-Bold"><%=soSoHoKhau %></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="so-dinh-danh-ca-nhan" /></td>
			<td class="txt-Bold"><%=soDinhDanhCaNhan %></td>
			<td><liferay-ui:message key="so-cmnd" /></td>
			<td class="txt-Bold"><%=soCMND %></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="so-ho-chieu" /></td>
			<td class="txt-Bold"><%=soHoChieu %></td>
			<td><liferay-ui:message key="ngay-cap" /></td>
			<td class="txt-Bold"><%=ngayCap %></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="noi-sinh" /></td>
			<td class="txt-Bold"><%=noiSinh %></td>
			<td><liferay-ui:message key="ngay-sinh" /></td>
			<td class="txt-Bold"><%=ngaySinh %></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="ton-giao" /></td>
			<td class="txt-Bold"><%=tonGiao %></td>
			<td><liferay-ui:message key="quoc-tich" /></td>
			<td class="txt-Bold"><%=quocTich %></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="noi-thuong-tru" /></td>
			<td colspan="2">
				<fieldset disabled="disabled" class="readonly-data">
					<select class="display-inline" style="width: 30%; margin-right: 7px;" name="<portlet:namespace/>noiThuongTruTinhId" id="<portlet:namespace/>noiThuongTruTinhId" onchange="loadQuanHuyen('<portlet:namespace />noiThuongTruTinhId', '<portlet:namespace />noiThuongTruQuanHuyenId', '<portlet:namespace />noiThuongTruPhuongXaId', '<%=loadQuanHuyen.toString() %>','<%=noiThuongTruQuanHuyenId %>');">
						<option value="0"><liferay-ui:message key="chon-tinh" /></option>
						<%
						List<Tinh> tinhs = TinhLocalServiceUtil.findAll();
						for (Tinh tinh : tinhs) {
						%>
						<option value="<%=tinh.getTinhId() %>" <%=(noiThuongTruTinhId == tinh.getTinhId() || tinh.getLaMacDinh()) ? "selected=selected" : StringPool.BLANK %>><%=tinh.getTenTinh() %></option>
						<%
						}
						%>
					</select>
					<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiThuongTruQuanHuyenId" id="<portlet:namespace/>noiThuongTruQuanHuyenId" onchange="loadPhuongXa('<portlet:namespace/>noiThuongTruQuanHuyenId', '<portlet:namespace/>noiThuongTruPhuongXaId', '<%=loadPhuongXa.toString() %>', '<%=noiThuongTruPhuongXaId %>');">
						<option value="0"><liferay-ui:message key="chon-quan-huyen" /></option>
					</select> 
					<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiThuongTruPhuongXaId" id="<portlet:namespace/>noiThuongTruPhuongXaId">
							<option value="0"><liferay-ui:message key="chon-phuong-xa" /></option>
					</select>
				</fieldset>
			</td>
			<td><input readonly="readonly" type="text" name="<portlet:namespace/>noiThuongTruDiaChi" id="<portlet:namespace/>noiThuongTruDiaChi" value="<%=noiThuongTruDiaChi %>" /></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="noi-tam-tru" /></td>
			<td colspan="2">
				<fieldset <%=isDisplay ? "disabled='disabled' class='readonly-data'" : "" %>>
					<select class="display-inline" style="width: 30%; margin-right: 7px;" name="<portlet:namespace/>noiTamTruTinhId" id="<portlet:namespace/>noiTamTruTinhId" onchange="loadQuanHuyen('<portlet:namespace />noiTamTruTinhId', '<portlet:namespace />noiTamTruQuanHuyenId', '<portlet:namespace />noiTamTruPhuongXaId','<%=loadQuanHuyen.toString() %>','<%=noiTamTruQuanHuyenId %>'); ">
						<option value="0"><liferay-ui:message key="chon-tinh" /></option>
						<%
						for (Tinh tinh : tinhs) {
						%>
						<option value="<%=tinh.getTinhId() %>" <%=(noiTamTruTinhId == tinh.getTinhId() || tinh.getLaMacDinh()) ? "selected=selected" : StringPool.BLANK %>><%=tinh.getTenTinh() %></option>
						<%
						}
						%>
					</select>
					<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiTamTruQuanHuyenId" id="<portlet:namespace/>noiTamTruQuanHuyenId" onchange="loadPhuongXa('<portlet:namespace/>noiTamTruQuanHuyenId', '<portlet:namespace/>noiTamTruPhuongXaId', '<%=loadPhuongXa.toString() %>', '<%=noiTamTruPhuongXaId %>');">
						<option value="0"><liferay-ui:message key="chon-quan-huyen" /></option>
					</select>
					<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiTamTruPhuongXaId" id="<portlet:namespace/>noiTamTruPhuongXaId">
						<option value="0"><liferay-ui:message key="chon-phuong-xa" /></option>
					</select>
				</fieldset>
			</td>
			<td><input <%=isDisplay ? "readonly='readonly'" : "" %> type="text" name="<portlet:namespace/>noiTamTruDiaChi" id="<portlet:namespace/>noiTamTruDiaChi" value="<%=noiTamTruDiaChi %>" /></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="ho-va-ten-cha" /></td>
			<td><input type="text" name="<portlet:namespace/>hoTenCha" <%=isDisplay ? "readonly='readonly'" : "" %> id="<portlet:namespace/>hoTenCha" value="<%=hoTenCha %>" /></td>
			<td><liferay-ui:message key="ho-va-ten-me" /></td>
			<td><input type="text" name="<portlet:namespace/>hoTenMe" <%=isDisplay ? "readonly='readonly'" : "" %> id="<portlet:namespace/>hoTenMe" value="<%=hoVaTenMe %>" /></td>
		</tr>
		<tr>
			<td><liferay-ui:message key="ten-vo-hoac-chong" /></td>
			<td><input type="text" name="<portlet:namespace/>hoTenVoHoacChong" <%=isDisplay ? "readonly='readonly'" : "" %> id="<portlet:namespace/>hoTenVoHoacChong" value="<%=hoTenVoHoacChong %>" /></td>
			<td></td>
			<td></td>
		</tr>
	</table>

	<liferay-ui:header title="thong-tin-tien-an" showBackURL="<%=false %>"></liferay-ui:header>
	
	<table class="gridnormal">
		<tr>
			<td class="aui-w20"><liferay-ui:message key="toa-an-xu-phat" />&nbsp;<font color="red">*</font></td>
			<td class="aui-w30"><input type="text" <%=isDisplay ? "readonly='readonly'" : "" %> class="mandatory" message="<liferay-ui:message key='toa-an-xu-phat' />" name="<portlet:namespace/>toaAnXuPhat" value="<%=toaAnXuPhat %>" /></td>
			<td class="aui-w20"></td>
			<td class="aui-w30"></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="ban-an-so" />&nbsp;<font color="red">*</font></td>
			<td><input <%=isDisplay ? "readonly='readonly'" : "" %> type="text" class="mandatory" message="<liferay-ui:message key='ban-an-so' />" name="<portlet:namespace/>banAnSo" value="<%=banAnSo %>" /></td>
			<td><liferay-ui:message key="ngay-toa-an" />&nbsp;<font color="red">*</font></td>
			<td class="ip-datepicker"><input <%=isDisplay ? "readonly='readonly'" : "" %> class="mandatory" message="<liferay-ui:message key='ngay-toa-an' />" style="width: 89%;" type="text" name="<portlet:namespace/>ngayToaAn" id="<portlet:namespace/>ngayToaAn" value="<%=ngayToaAn %>" /></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="toi-danh-dieu-luat-ap-dung" />&nbsp;<font color="red">*</font></td>
			<td colspan="3"><textarea <%=isDisplay?"readonly='readonly'":""%> name="<portlet:namespace/>toiDanh" class="mandatory" message="<liferay-ui:message key='toi-danh-dieu-luat-ap-dung' />" id="<portlet:namespace/>toiDanh"><%=toiDanh %></textarea></td>
		</tr>
		<tr>
			<td><liferay-ui:message key="hinh-phat-chinh" />&nbsp;<font color="red">*</font></td>
			<td colspan="3"><textarea <%=isDisplay ? "readonly='readonly'" : "" %> name="<portlet:namespace/>hinhPhatChinh" class="mandatory" message="<liferay-ui:message key='hinh-phat-chinh' />" id="<portlet:namespace/>hinhPhatChinh"><%=hinhPhatChinh %></textarea></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="hinh-phat-bo-sung" /></td>
			<td colspan="3"><textarea <%=isDisplay ? "readonly='readonly'" : "" %> name="<portlet:namespace/>hinhPhatBoSung"><%=hinhPhatBoSung %></textarea></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="nghia-vu-dan-su" /></td>
			<td colspan="3"><textarea <%=isDisplay ? "readonly='readonly'" : "" %> name="<portlet:namespace/>nghiaVuDanSu"><%=nghiaVuDanSu %></textarea></td>
		</tr>
		<tr>
			<td><liferay-ui:message key="an-phi" />&nbsp;<font color="red">*</font></td>
			<td colspan="3"><textarea <%=isDisplay ? "readonly='readonly'" : "" %> name="<portlet:namespace/>anPhi" class="mandatory" message="<liferay-ui:message key='an-phi' />" id="<portlet:namespace/>anPhi"><%=anPhi %></textarea></td>

		</tr>
		<tr>
			<td><liferay-ui:message key="tien-an-neu-co" /></td>
			<td colspan="3"><textarea <%=isDisplay ? "readonly='readonly'" : "" %> name="<portlet:namespace/>moTaTienAn" id="<portlet:namespace/>moTaTienAn"><%=moTaTienAn %></textarea></td>

		</tr>
		<tr>
			<td><liferay-ui:message key="ghi-chu" /></td>
			<td colspan="3"><textarea <%=isDisplay ? "readonly='readonly'" : "" %> name="<portlet:namespace/>chuThich"><%=chuThich %></textarea></td>
		</tr>
	</table>

	<liferay-ui:header title="thong-tin-noi-lap-phieu" showBackURL="<%=false %>"></liferay-ui:header>
	<table class="gridnormal">
		<tr>
			<td class="aui-w20"><liferay-ui:message key="ma-so-phieu-thong-tin-tien-an" />&nbsp;<font color="red">*</font></td>
			<td class="aui-w30">
				<input type="text" style="width: 60%;" id="<portlet:namespace/>maSoHoSoTienAnTuToaAn" name="<portlet:namespace/>maSoHoSoTienAnTuToaAn" value="<%=maSoHoSoTienAnTuToaAn %>" readonly="readonly" />
				<c:if test="<%=Validator.isNull(maSoHoSoTienAnTuToaAn) %>">
					<input type="button" class="btn" value="<liferay-ui:message key="lay-so" />" onclick="<portlet:namespace/>layMa();" />
				</c:if>
			</td>
			<td class="aui-w20">
			</td>
			<td class="aui-w30"></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="nguoi-trich-luc" />&nbsp;<font color="red">*</font></td>
			<td><input type="text" <%=isDisplay ? "readonly='readonly'" : "" %> name="<portlet:namespace/>nguoiTrichLuc" class="mandatory" message="<liferay-ui:message key='nguoi-trich-luc' />" value="<%=nguoiTrichLuc %>" /></td>
		
			<td><liferay-ui:message key="tham-phan" />&nbsp;<font color="red">*</font></td>
			<td><input type="text" <%=isDisplay ? "readonly='readonly'" : "" %> name="<portlet:namespace/>thamPhan" class="mandatory" message="<liferay-ui:message key='tham-phan' />" value="<%=thamPhan %>" /></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="chu-thich" /></td>
			<td colspan="3"><textarea <%=isDisplay ? "readonly='readonly'" : "" %> name="<portlet:namespace/>chuThichThongTinNoiLapPhieu"><%=chuThichCuaPhieuThongTin %></textarea></td>
		</tr>

		<tr>
			<td></td>
			<td colspan="3">
				<div align="left">
					<%
					if (!isDisplay) {
						if (Validator.isNull(thaoTac)) {
					%>
					<input type="button" class="btn btn-primary" value="<liferay-ui:message key="luu" />" onclick="<portlet:namespace/>confirmMsg();" />

					<%
						} else {
							if (Validator.isNull(undoRedo)|| undoRedo.equals(ThaoTacUndoRedoEnum.UNDO.getKey())) {
					%>
					<input type="button" class="btn btn-primary" value="<liferay-ui:message key="undo" />" onclick="<portlet:namespace/>confirmMsg();" />

					<%
							} else {
					%>
					<input type="button" class="btn btn-primary" value="<liferay-ui:message key="redo" />" onclick="<portlet:namespace/>confirmMsg();" />

					<%
							}
						}
					} else {
					%>
					<input type="button" class="btn btn-primary" onclick="inDuLieu('<%=inReportURL.toString() %>');" value="<liferay-ui:message key="in-thong-tin" />" />
					<%
						}
					%>

					<input type="button" class="btn" onclick="javascript:submitForm(document.hrefFm,'<%=redirect %>');" value="<liferay-ui:message key="tro-ve" />" />
				</div>
			</td>
		</tr>
	</table>
</form>

<script type="text/javascript">
$(function() {
	 loadQuanHuyen('<portlet:namespace />noiThuongTruTinhId', '<portlet:namespace />noiThuongTruQuanHuyenId', '<portlet:namespace />noiThuongTruPhuongXaId', '<%=loadQuanHuyen.toString()%>','<%=noiThuongTruQuanHuyenId%>');
	 loadPhuongXa('<portlet:namespace/>noiThuongTruQuanHuyenId', '<portlet:namespace/>noiThuongTruPhuongXaId', '<%=loadPhuongXa.toString()%>', '<%=noiThuongTruPhuongXaId%>');
	 loadQuanHuyen('<portlet:namespace />noiTamTruTinhId', '<portlet:namespace />noiTamTruQuanHuyenId', '<portlet:namespace />noiTamTruPhuongXaId', '<%=loadQuanHuyen.toString()%>','<%=noiTamTruQuanHuyenId%>');
	 loadPhuongXa('<portlet:namespace/>noiTamTruQuanHuyenId', '<portlet:namespace/>noiTamTruPhuongXaId', '<%=loadPhuongXa.toString()%>', '<%=noiTamTruPhuongXaId%>');
});
</script>


